/**
 * 
 */
package com.p2p.front.dal.model;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import com.p2p.base.model.Money;

/**
 * @author ruiqi
 *
 */
public class LoanInfo implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = 3634738212206288527L;
	
	private Long lid;//贷款ID
	private Long plid;//上级贷款ID
	private Long uid;//用户ID
	private Integer aid;//管理员ID
	private String title;//贷款标题
	private String img;//贷款图片
	private Integer type;//标类型
	private Integer isFlow;//是否流转标
	private Integer isField;//是否为实地认证
	private Integer isPlan;//是否保障计划
	private Integer isOkout;//是否自动放款
	private Integer isNewbie;//是否为新手专享
	private Integer noCaptcha;//无需验证码
	private String useType;//贷款用途
	private Money amount = new Money();//贷款金额
	private Money lateFee = new Money();//逾期费用
	private Money earlyFee = new Money();//提前还款违约金
	private Double feeRate;//服务费率
	private Double mfeeRate;//管理费率
	private Money fieldFee = new Money();// 地考察费
	private Money creditFee = new Money();//征信代查费
	private Money otherFee = new Money();//其它服务费
	private Money tenderMin = new Money();//最小投标额
	private Money tenderMax = new Money();//最大投标额
	private Integer tenderLimitTimes;//限制投标次数
	private Integer tenderCount;//总投标次数
	private Date tenderBegin;//招标开始时间
	private Date tenderEnd;//满标时间
	private Integer deadline;//贷款期限
	private String deadlineType;//期限类型:m-月,y-年,d-天,a-时
	private Integer days;//几天标
	private Double apr;//贷款年利率
	private Double rewardApr;//奖励年利率
	private Money rewardMoney = new Money();//投标奖励金额
	private String repayMethod;//还款方式:m-按月分期,i-按月付息,到期还本,e-到期还本息
	private Integer progress;//贷款进度
	private Date exptime;//贷款过期时间
	private Date begintime;//还款起始时间
	private Date endtime;//贷款结束时间
	private Integer status;//状态: 1-草稿,2-无效,3-审核失败,11-待审核,12-待发布,21-招标中,31-已流标,32-满标待审,41-还款中,51-还款成功
	private Integer ostatus;//状态: 1-草稿,2-无效,3-审核失败,11-待审核,12-待发布,21-招标中,31-已流标,32-满标待审,41-还款中,51-还款成功
	private Integer auto;//是否进行过自动投标
	private String description;//贷款描述
	private String remark;//贷款备注
	private String lrealname;//流转债权人真实姓名
	private String lidcard;//流转债权人身份证号
	private String lno;//流转借款合同编号
	private Date addtime;//创建时间
	private Date uptime;//更新时间
	private Date paytime;//还款时间	
	
	private LoanVariation loanVariation;
	private List<LoanPhoto> loanPhotoList;
	private Integer creditRate;
	
	//额外增加的非数据库字段
	private Money monthReturn = new Money();//等额本息的本息总额
	private Money monthInterest= new Money();//按月付息的利息
	private Money repayAmount= new Money();//到期还本息的所有总额
	/**
	 * 
	 * 检查状态是否是可以投标的状态，0是不能投标，1是状态为可投标，2可投标（状态为待发布，但开标时间已到，仍然是可投标状态）
	 * 
	 * @return
	 */
	public int checkStatusCanTender(){
		if(status==21){
			return 1;
		}
		else if(status==12){
			if(tenderBegin.getTime()<System.currentTimeMillis()){
				return 2;
			}
		}
		return 0;
	}
	public double getReturnApr(){
		return this.apr==null?0l:this.apr+(this.rewardApr==null?0l:this.rewardApr);
	}
	
	public Long getLid() {
		return lid;
	}
	public void setLid(Long lid) {
		this.lid = lid;
	}
	public Long getPlid() {
		return plid;
	}
	public void setPlid(Long plid) {
		this.plid = plid;
	}
	public Long getUid() {
		return uid;
	}
	public void setUid(Long uid) {
		this.uid = uid;
	}
	public Integer getAid() {
		return aid;
	}
	public void setAid(Integer aid) {
		this.aid = aid;
	}
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public String getImg() {
		return img;
	}
	public void setImg(String img) {
		this.img = img;
	}
	public Integer getType() {
		return type;
	}
	public void setType(Integer type) {
		this.type = type;
	}
	public Integer getIsFlow() {
		return isFlow;
	}
	public void setIsFlow(Integer isFlow) {
		this.isFlow = isFlow;
	}
	public Integer getIsField() {
		return isField;
	}
	public void setIsField(Integer isField) {
		this.isField = isField;
	}
	public Integer getIsPlan() {
		return isPlan;
	}
	public void setIsPlan(Integer isPlan) {
		this.isPlan = isPlan;
	}
	public Integer getIsOkout() {
		return isOkout;
	}
	public void setIsOkout(Integer isOkout) {
		this.isOkout = isOkout;
	}
	public Integer getIsNewbie() {
		return isNewbie;
	}
	public void setIsNewbie(Integer isNewbie) {
		this.isNewbie = isNewbie;
	}
	public Integer getNoCaptcha() {
		return noCaptcha;
	}
	public void setNoCaptcha(Integer noCaptcha) {
		this.noCaptcha = noCaptcha;
	}
	public String getUseType() {
		return useType;
	}
	public void setUseType(String useType) {
		this.useType = useType;
	}
	public Money getAmount() {
		return amount;
	}
	public void setAmount(Money amount) {
		this.amount = amount;
	}
	public Money getLateFee() {
		return lateFee;
	}


	public void setLateFee(Money lateFee) {
		this.lateFee = lateFee;
	}


	public Money getEarlyFee() {
		return earlyFee;
	}


	public void setEarlyFee(Money earlyFee) {
		this.earlyFee = earlyFee;
	}


	public Double getFeeRate() {
		return feeRate;
	}
	public void setFeeRate(Double feeRate) {
		this.feeRate = feeRate;
	}
	public Double getMfeeRate() {
		return mfeeRate;
	}
	public void setMfeeRate(Double mfeeRate) {
		this.mfeeRate = mfeeRate;
	}
	public Money getFieldFee() {
		return fieldFee;
	}
	public void setFieldFee(Money fieldFee) {
		this.fieldFee = fieldFee;
	}
	public Money getCreditFee() {
		return creditFee;
	}
	public void setCreditFee(Money creditFee) {
		this.creditFee = creditFee;
	}
	public Money getOtherFee() {
		return otherFee;
	}
	public void setOtherFee(Money otherFee) {
		this.otherFee = otherFee;
	}
	public Money getTenderMin() {
		return tenderMin;
	}
	public void setTenderMin(Money tenderMin) {
		this.tenderMin = tenderMin;
	}
	public Money getTenderMax() {
		return tenderMax;
	}
	public void setTenderMax(Money tenderMax) {
		this.tenderMax = tenderMax;
	}
	public Integer getTenderLimitTimes() {
		return tenderLimitTimes;
	}
	public void setTenderLimitTimes(Integer tenderLimitTimes) {
		this.tenderLimitTimes = tenderLimitTimes;
	}
	public Integer getTenderCount() {
		return tenderCount;
	}
	public void setTenderCount(Integer tenderCount) {
		this.tenderCount = tenderCount;
	}
	public Date getTenderBegin() {
		return tenderBegin;
	}
	public void setTenderBegin(Date tenderBegin) {
		this.tenderBegin = tenderBegin;
	}
	public Date getTenderEnd() {
		return tenderEnd;
	}
	public void setTenderEnd(Date tenderEnd) {
		this.tenderEnd = tenderEnd;
	}
	public Integer getDeadline() {
		return deadline;
	}
	public void setDeadline(Integer deadline) {
		this.deadline = deadline;
	}
	public String getDeadlineType() {
		return deadlineType;
	}
	public void setDeadlineType(String deadlineType) {
		this.deadlineType = deadlineType;
	}
	public Integer getDays() {
		return days;
	}
	public void setDays(Integer days) {
		this.days = days;
	}
	public Double getApr() {
		return apr;
	}
	public void setApr(Double apr) {
		this.apr = apr;
	}
	public Double getRewardApr() {
		return rewardApr;
	}
	public void setRewardApr(Double rewardApr) {
		this.rewardApr = rewardApr;
	}
	public Money getRewardMoney() {
		return rewardMoney;
	}
	public void setRewardMoney(Money rewardMoney) {
		this.rewardMoney = rewardMoney;
	}
	public String getRepayMethod() {
		return repayMethod;
	}
	public void setRepayMethod(String repayMethod) {
		this.repayMethod = repayMethod;
	}
	public Integer getProgress() {
		return progress;
	}
	public void setProgress(Integer progress) {
		this.progress = progress;
	}
	public Date getExptime() {
		return exptime;
	}
	public void setExptime(Date exptime) {
		this.exptime = exptime;
	}
	public Date getBegintime() {
		return begintime;
	}
	public void setBegintime(Date begintime) {
		this.begintime = begintime;
	}
	public Date getEndtime() {
		return endtime;
	}
	public void setEndtime(Date endtime) {
		this.endtime = endtime;
	}
	public Integer getStatus() {
		return status;
	}
	public void setStatus(Integer status) {
		this.status = status;
	}
	public Integer getOstatus() {
		return ostatus;
	}
	public void setOstatus(Integer ostatus) {
		this.ostatus = ostatus;
	}
	public Integer getAuto() {
		return auto;
	}
	public void setAuto(Integer auto) {
		this.auto = auto;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	public String getRemark() {
		return remark;
	}
	public void setRemark(String remark) {
		this.remark = remark;
	}
	public String getLrealname() {
		return lrealname;
	}
	public void setLrealname(String lrealname) {
		this.lrealname = lrealname;
	}
	public String getLidcard() {
		return lidcard;
	}
	public void setLidcard(String lidcard) {
		this.lidcard = lidcard;
	}
	public String getLno() {
		return lno;
	}
	public void setLno(String lno) {
		this.lno = lno;
	}
	public Date getAddtime() {
		return addtime;
	}
	public void setAddtime(Date addtime) {
		this.addtime = addtime;
	}
	public Date getUptime() {
		return uptime;
	}
	public void setUptime(Date uptime) {
		this.uptime = uptime;
	}
	public Date getPaytime() {
		return paytime;
	}
	public void setPaytime(Date paytime) {
		this.paytime = paytime;
	}


	public LoanVariation getLoanVariation() {
		return loanVariation;
	}


	public void setLoanVariation(LoanVariation loanVariation) {
		this.loanVariation = loanVariation;
	}


	public List<LoanPhoto> getLoanPhotoList() {
		return loanPhotoList;
	}
	public void setLoanPhotoList(List<LoanPhoto> loanPhotoList) {
		this.loanPhotoList = loanPhotoList;
	}
	@Override
	public String toString() {
		return "LoanInfo [lid=" + lid + ", plid=" + plid + ", uid=" + uid
				+ ", aid=" + aid + ", title=" + title + ", img=" + img
				+ ", type=" + type + ", isFlow=" + isFlow + ", isField="
				+ isField + ", isPlan=" + isPlan + ", isOkout=" + isOkout
				+ ", isNewbie=" + isNewbie + ", noCaptcha=" + noCaptcha
				+ ", useType=" + useType + ", amount=" + amount + ", lateFee="
				+ lateFee + ", earlyFee=" + earlyFee + ", feeRate=" + feeRate
				+ ", mfeeRate=" + mfeeRate + ", fieldFee=" + fieldFee
				+ ", creditFee=" + creditFee + ", otherFee=" + otherFee
				+ ", tenderMin=" + tenderMin + ", tenderMax=" + tenderMax
				+ ", tenderLimitTimes=" + tenderLimitTimes + ", tenderCount="
				+ tenderCount + ", tenderBegin=" + tenderBegin + ", tenderEnd="
				+ tenderEnd + ", deadline=" + deadline + ", deadlineType="
				+ deadlineType + ", days=" + days + ", apr=" + apr
				+ ", rewardApr=" + rewardApr + ", rewardMoney=" + rewardMoney
				+ ", repayMethod=" + repayMethod + ", progress=" + progress
				+ ", exptime=" + exptime + ", begintime=" + begintime
				+ ", endtime=" + endtime + ", status=" + status + ", ostatus="
				+ ostatus + ", auto=" + auto + ", description=" + description
				+ ", remark=" + remark + ", lrealname=" + lrealname
				+ ", lidcard=" + lidcard + ", lno=" + lno + ", addtime="
				+ addtime + ", uptime=" + uptime + ", paytime=" + paytime + "]";
	}


	public Integer getCreditRate() {
		return creditRate;
	}


	public void setCreditRate(Integer creditRate) {
		this.creditRate = creditRate;
	}
	public Money getMonthReturn() {
		return monthReturn;
	}
	public void setMonthReturn(Money monthReturn) {
		this.monthReturn = monthReturn;
	}
	public Money getMonthInterest() {
		return monthInterest;
	}
	public void setMonthInterest(Money monthInterest) {
		this.monthInterest = monthInterest;
	}
	public Money getRepayAmount() {
		return repayAmount;
	}
	public void setRepayAmount(Money repayAmount) {
		this.repayAmount = repayAmount;
	}



	
}
